package com.sort;

public class test4 {
  public static void main(String[] args) {
    // 选择排序
    int[] arr = {3,5,1,7,2,9,8,4,0};

    for (int i = 0; i < arr.length; i++) {
      int min_index = 0;
      for (int j = i+1; j < arr.length; j++) {
        if(arr[min_index] > arr[j]){
          min_index = j;
        }
      }
      if(min_index != 1){
        int temp = arr[min_index];
        arr[min_index] = arr[i];
        arr[i] = temp;
      }
    }
  }
}
